
// 442.数组中重复的数据
class Solution {
public:
    vector<int> findDuplicates(vector<int>& nums) {
        int n = nums.size();
        vector<int> ret;
        for(int i = 0 ; i < n ; i++)
        {
            int x = abs(nums[i]);
            if(nums[x - 1] < 0) ret.push_back(x);
            else nums[x - 1] = -nums[x - 1];
        }
        return ret;
    }
};